#include "updatepronamedlg.h"
#include "ui_updatepronamedlg.h"

QString newProName;

updateProNameDlg::updateProNameDlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::updateProNameDlg)
{
    ui->setupUi(this);
    
    connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateBtn()));
    connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(getNewProName()));
    connect(ui->OKBtn, SIGNAL(clicked(bool)), this, SLOT(accept()));
    connect(ui->cancelBtn, SIGNAL(clicked(bool)), this, SLOT(close()));
}

updateProNameDlg::~updateProNameDlg()
{
    delete ui;
}

void updateProNameDlg::updateBtn()
{
    if(ui->lineEdit->text().isEmpty())
        ui->OKBtn->setEnabled(false);
    else {
        ui->OKBtn->setEnabled(true);
    }
}

void updateProNameDlg::getNewProName()
{
    this->proName = ui->lineEdit->text();
}
